package com.muyu.user.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.muyu.common.core.annotation.Excel;
import lombok.Data;
import java.io.Serial;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder;
import com.muyu.user.domain.model.SysUserTagSaveModel;
import com.muyu.user.domain.model.SysUserTagEditModel;
import com.muyu.common.core.web.domain.BaseEntity;

/**
 * 用户标签数据库映射对象 sys_user_tag
 *
 * @author liuguoqiang
 * @date 2025-09-14
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName("sys_user_tag")
@EqualsAndHashCode(callSuper = true)
public class SysUserTag extends BaseEntity {
    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 标签ID
     */
    @Excel(name = "标签ID")
    @TableId(value = "tag_id",type = IdType.AUTO)
    private Long tagId;

    /**
     * 标签名称
     */
    @Excel(name = "标签名称")
    private String tagName;

    /**
     * 标签编码
     */
    private String tagCode;

    /**
     * 标签颜色
     */
    private String tagColor;

    /**
     * 标签描述
     */
    private String description;

    /**
     * 排序
     */
    private Long sortOrder;

    /**
     * 状态（0正常 1停用）
     */
    private String status;


    /**
     * 添加构造器
     */
    public static SysUserTag saveModelBuild(SysUserTagSaveModel saveModel){
        return SysUserTag.builder()
            .tagId(saveModel.getTagId())
            .tagName(saveModel.getTagName())
            .tagCode(saveModel.getTagCode())
            .tagColor(saveModel.getTagColor())
            .description(saveModel.getDescription())
            .sortOrder(saveModel.getSortOrder())
            .status(saveModel.getStatus())
            .build();
    }

    /**
     * 修改构造器
     */
    public static SysUserTag editModelBuild(SysUserTagEditModel editModel){
        return SysUserTag.builder()
            .tagId(editModel.getTagId())
            .tagId(editModel.getTagId())
            .tagName(editModel.getTagName())
            .tagCode(editModel.getTagCode())
            .tagColor(editModel.getTagColor())
            .description(editModel.getDescription())
            .sortOrder(editModel.getSortOrder())
            .status(editModel.getStatus())
            .build();
    }

}
